package com.tywj.buscustomerapp.view.item;

import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.tywj.buscustomerapp.R;
import com.tywj.buscustomerapp.model.bean.StationBean;
import com.tywj.buscustomerapp.utils.myadapter.item.AdapterItem;

public class StationItem implements AdapterItem<StationBean> {
    private TextView time;
    private TextView station;
    private View line1;
    private ImageView img;
    private int size =0;

    public StationItem(int size) {
        this.size = size;
    }

    @Override
    public int getLayoutResId() {
        return R.layout.item_station_layout;
    }

    @Override
    public void bindViews(@NonNull View root) {
        line1 = root;
        time = root.findViewById(R.id.time);
        station = root.findViewById(R.id.station);
        img = root.findViewById(R.id.image);
    }

    @Override
    public void setViews() {

    }

    @Override
    public void handleData(StationBean stationBean, int position) {
        if (position==0){
            station.setTextColor(line1.getResources().getColor(R.color.black));
            time.setTextColor(line1.getResources().getColor(R.color.black));
            img.setImageResource(R.mipmap.icon_get_on_my_27x27);
            time.setText(stationBean.getTime());
            station.setTextSize(11);
        }else{
            station.setTextColor(line1.getResources().getColor(R.color.textgray));
            time.setTextColor(line1.getResources().getColor(R.color.textgray));
            img.setImageResource(R.mipmap.icon_get_on_27x27);
            time.setText("预计"+stationBean.getTime());
            station.setTextSize(10);
        }
        if (stationBean.isEnd && position!=0) {
            station.setTextColor(line1.getResources().getColor(R.color.black));
            time.setTextColor(line1.getResources().getColor(R.color.black));
            img.setImageResource(R.mipmap.icon_get_off_my_27x27);
            station.setTextSize(11);
        }
        station.setText(stationBean.getName());

    }
}
